package gitdemo1.git3.day;

public class Hanoi {
    public static void main(String[] args) {
        func(3, "左", "右", "中");
    }
    public static void process(char str[],int i){
        if(i==str.length){
            System.out.println(String.valueOf(str));
            return;
        }
        process(str, i+1);
        char temp=str[i];
        str[i]=0;
        process(str, i+1);
        str[i]=temp;
    }

    public static void func(int size,String from,String to,String other   ){
        if(size==1){
            System.out.println("把第"+size+"从"+from+"移到"+to );
        }else{
            func(size-1, from, other, to);
            System.out.println("把第"+size+"从"+from+"移到"+to );
            func(size-1, other, to, from);
        }
    }
}
